#include "../../include/car_parts/gyroscope.h"
Gyroscope::Gyroscope()
{
    this->model = "CH110";
    this->manufacturer = "NXP";
}
void Gyroscope::setModel(const std::string &model)
{
    this->model = model;
}

void Gyroscope::setManufacturer(const std::string &manufacturer)
{
    this->manufacturer = manufacturer;
}

// 屏幕输出
void Gyroscope::print()
{
    std::cout << "**陀螺仪模块**"
              << "\n陀螺仪厂家: " << manufacturer << "\n陀螺仪型号: " << model << std::endl;
}
// 本地文件保存
void Gyroscope::save(const std::string &filename)
{
    // 打开一个输出文件流
    std::ofstream file(filename, std::ios::app);
    if (!file.is_open())
    {
        std::cout << "未找到文件！" << std::endl;
        return;
    }

    file << "," << manufacturer << "," << model;

    // 关闭文件流
    file.close();
}